import style from '@/common/js/style.js';
// #ifdef MP
function toPx(value) {
	const result = /(\d+\.?\d*)(\w+)/.exec(value);
	if ('rpx' === result[2].trim()) {
		return uni.getSystemInfoSync().screenWidth * Number(result[1]) / 750;
	} else if('px' === result[2].trim()) {
		return Number(result[1]);
	} else {
		throw new TypeError(`${value}单位格式不正确`);
	}
	
}

const systemInfo = uni.getSystemInfoSync();
const statusBarHeight = systemInfo.statusBarHeight;
const windowWidth = systemInfo.windowWidth;
const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
let navBarHeight = menuButtonInfo.height + 2*(menuButtonInfo.top - statusBarHeight);
let navBarRightOffset = windowWidth - menuButtonInfo.left;
// console.log(menuButtonInfo,statusBarHeight, systemInfo);
// #endif

const user = {
	data() {
		return {
			navBgImageConfig: 'https://img12.360buyimg.com/img/s750x528_jfs/t1/128030/21/3281/68358/5ecfdcd6e0c65b059/69d8af767c4e4f18.png.webp',
			navBarConfig: {
				// #ifndef MP
				fixedHeight: `100rpx`,
				// #endif
				// #ifdef MP
				fixedHeight: `${navBarHeight}px`,
				// #endif
				right: {
					fontFamily: 'tpf-iconfont',
					iconList: [
						{
							url: '/pages/ucenter/setting/setting',
							text: '设置',
							textSize: `${style.UNI_FONT_SIZE_BASE}`,
						},
						{
							url: '/pages/ucenter/message-lists/message-lists',
							text: '\ue61d',
							textSize: `${style.UNI_ICON_SIZE_SM}`,
						}
					],
				},
			},
			certConfig:{
				fontFamily: 'tpf-iconfont',
				text:"实名认证",
				icon:{
					text: '\ue7a2'
				}
			},
			orderSectionConfig: {
				fontFamily: 'tpf-iconfont',
				textStyle: `font-size: ${style.UNI_ICON_SIZE_MD}`,
				titleStyle: `font-size: ${style.UNI_FONT_SIZE_SM};margin-top: ${style.UNI_SPACING_ROW_SM};`,
				subtitleStyle: `font-size: ${style.UNI_FONT_SIZE_MI};margin-top: ${style.UNI_SPACING_ROW_SM};`,
				iconList: [
					{
						url: '/pages/order/order?tabid=1',
						text: '\ue7a2',
						title: '待付款',
						subtitle: '',
					},
					{
						url: '/pages/order/order?tabid=2',
						text: '\ue604',
						title: '待收货',
						subtitle: '',
					},
					{
						url: '/pages/order/order?tabid=3',
						text: '\ue649',
						title: '待发货',
						subtitle: '',
					},
					{
						url: '/pages/comment/comment-list',
						text: '\ue612',
						title: '待评价',
						subtitle: '送积分',
					},
					
					{
						url: '/pages/order/order?tabid=0',
						text: '\ue67c',
						title: '我的订单',
						subtitle: '全部订单',
						textStyle: `color: ${style.UNI_TEXT_COLOR_RED};`
					},
				]
			},
			
			liveListConfig: {
				fontFamily: 'tpf-iconfont',
				thumbStyle: `width: ${style.UNI_ICON_SIZE_BASE};
							height: ${style.UNI_ICON_SIZE_BASE};`,
				titleStyle: `font-size: ${style.UNI_FONT_SIZE_SM};margin-top: ${style.UNI_SPACING_ROW_SM};`,
				subtitleStyle: `font-size: ${style.UNI_FONT_SIZE_MI};margin-top: ${style.UNI_SPACING_ROW_SM};`,
				checkIconList:[
					{
						url:"/pages/live/agreement/agreement",
						thumb: '/static/user/agreement.png',
						title: '入住协议',
						subtitle: '',
					},
					{
						url:"",
						thumb: '/static/user/invite.png',
						title: '邀请主播',
						subtitle: '',
					},
					{
						url:"/pages/live/apply/apply",
						thumb: '/static/user/apply.png',
						title: '申请主播',
						subtitle: '实名认证',
					},
				],
				checkedIconList: [
					{
						url:"",
						thumb: '/static/user/invite.png',
						title: '邀请主播',
						subtitle: '',
					},
					{
						url:"",
						thumb: '/static/user/notice.png',
						title: '直播预告',
						subtitle: '',
					},
					{
						url:"",
						thumb: '/static/user/live-product.png',
						title: '直播商品',
						subtitle: '',
					},
					{
						url:"/pages/live/push/push",
						thumb: '/static/user/live.png',
						title: '开始直播',
						subtitle: '',
					}
				]
			},
			extListConfig: {
				fontFamily: 'tpf-iconfont',
				titleStyle: `font-size: ${style.UNI_FONT_SIZE_SM};margin-left: ${style.UNI_SPACING_ROW_SM};`,
				subtitleStyle: `font-size: ${style.UNI_FONT_SIZE_MI};margin-top: ${style.UNI_SPACING_ROW_SM};`,
				moreIcon:{
					url:"",
					text: '\ue605',
				},
				iconList:[
					{
						url:"/pages/ucenter/address/address",
						text: '\ue729',
						title: '收货地址',
					},
					{
						url:"/pages/ucenter/about-us/about-us",
						text: '\ue62a',
						title: '关于我们', 
					},
					{
						url:"/pages/ucenter/help-service/help-service",
						text: '\ue613',
						title: '客服帮助',
					},
					{
						url:"/pages/ucenter/feedback/feedback",
						text: '\ue736',
						title: '功能反馈',
					}
				]
			},
			//为你推荐
			recommendedProductListTitleConfig: {
				recommendIcon: {
					fontFamily: 'tpf-iconfont',
					thumb: '/static/cart/tuijian.png',
					title: '为你推荐',
					iconStyle: `
								margin-left: ${style.UNI_SPACING_COL_LG};
								margin-right: ${style.UNI_SPACING_COL_LG};
								`,
					titleStyle: `,
								font-size: ${style.UNI_FONT_SIZE_BASE};
								font-weight: bold;
								margin-left: ${style.UNI_SPACING_COL_SM};
								`,
				},
				lineIcon: {
					fontFamily: 'tpf-iconfont',
					text: '\ue643',
					textStyle: `
								font-size: ${style.UNI_ICON_SIZE_SM};
								font-weight: light;
								color: ${style.UNI_TEXT_COLOR_GREY};
								`,
				}
			},
			recommendedProductListConfig: {
				columnCount: 2,
				rowGap: `${style.UNI_SPACING_ROW_SM}`,
				columnGap: `${style.UNI_SPACING_COL_SM}`,
				leftGap: `${style.UNI_SPACING_COL_BASE}`,
				rightGap: `${style.UNI_SPACING_COL_BASE}`,
			}
		}	
			
	},
}

export default user;